{
mctelem_cookie_t mctc;
struct mca_summary bs;
- unsigned int event_enabled;
mctc = mcheck_mca_logout(MCA_POLLER, mca_allbanks, &bs, NULL);
- event_enabled = guest_enabled_event(dom0->vcpu[0], VIRQ_MCA);
-
if (bs.errcnt && mctc != NULL) {
static uint64_t dumpcount = 0;
* a simple-minded attempt to avoid spamming the console
* for corrected errors in early startup. */
- if (event_enabled) {
+ if (dom0_vmce_enabled()) {
mctelem_commit(mctc);
send_guest_global_virq(dom0, VIRQ_MCA);
} else if (++dumpcount >= 10) {
on_each_cpu(mce_amd_checkregs, data, 1);
if (adjust > 0) {
- if (!guest_enabled_event(dom0->vcpu[0], VIRQ_MCA) ) {
+ if (!dom0_vmce_enabled()) {
/* Dom0 did not enable VIRQ_MCA, so Xen is reporting. */
printk("MCE: polling routine found correctable error. "
" Use mcelog to parse above error output.\n");
* as terminal for any context.
*/
ctx_xen = SEG_PL(regs->cs) == 0;
- ctx_dom0 = !ctx_xen && (domid == dom0->domain_id);
+ ctx_dom0 = !ctx_xen && (domid == 0);
ctx_domU = !ctx_xen && !ctx_dom0;
xen_state_lost = bs.uc != 0 || (ctx_xen && (bs.pcc || !ripv)) ||
* XXFM Could add some Solaris dom0 contract kill here?
*/
if (dom0_state_lost) {
- if (guest_has_trap_callback(dom0, 0, TRAP_machine_check)) {
+ if (dom0 && dom0->max_vcpus && dom0->vcpu[0] &&
+ guest_has_trap_callback(dom0, 0, TRAP_machine_check)) {
dom_state = DOM0_TRAP;
send_guest_trap(dom0, 0, TRAP_machine_check);
/* XXFM case of return with !ripv ??? */
if (bs.errcnt) {
/* Not panicing, so forward telemetry to dom0 now if it
* is interested. */
- if (guest_enabled_event(dom0->vcpu[0], VIRQ_MCA)) {
+ if (dom0_vmce_enabled()) {
if (mctc != NULL)
mctelem_commit(mctc);
send_guest_global_virq(dom0, VIRQ_MCA);
void x86_mc_get_cpu_info(unsigned, uint32_t *, uint16_t *, uint16_t *,
uint32_t *, uint32_t *, uint32_t *, uint32_t *);
+#define dom0_vmce_enabled() (dom0 && dom0->max_vcpus && dom0->vcpu[0] \
+ && guest_enabled_event(dom0->vcpu[0], VIRQ_MCA))
/* Register a handler for machine check exceptions. */
typedef void (*x86_mce_vector_t)(struct cpu_user_regs *, long);
}
/* Step2: Send Log to DOM0 through vIRQ */
- if (dom0 && guest_enabled_event(dom0->vcpu[0], VIRQ_MCA)) {
+ if (dom0_vmce_enabled()) {
mce_printk(MCE_VERBOSE, "MCE: send MCE# to DOM0 through virq\n");
send_guest_global_virq(dom0, VIRQ_MCA);
}
MCA_CMCI_HANDLER, __get_cpu_var(mce_banks_owned), &bs, NULL);
if (bs.errcnt && mctc != NULL) {
- if (guest_enabled_event(dom0->vcpu[0], VIRQ_MCA)) {
+ if (dom0_vmce_enabled()) {
mctelem_commit(mctc);
send_guest_global_virq(dom0, VIRQ_MCA);
} else {
MCA_CMCI_HANDLER, __get_cpu_var(mce_banks_owned), &bs, NULL);
if (bs.errcnt && mctc != NULL) {
- if (guest_enabled_event(dom0->vcpu[0], VIRQ_MCA)) {
+ if (dom0_vmce_enabled()) {
mctelem_commit(mctc);
mce_printk(MCE_VERBOSE, "CMCI: send CMCI to DOM0 through virq\n");
send_guest_global_virq(dom0, VIRQ_MCA);
* for corrected errors in early startup.
*/
- if (guest_enabled_event(dom0->vcpu[0], VIRQ_MCA)) {
+ if (dom0_vmce_enabled()) {
mctelem_commit(mctc);
send_guest_global_virq(dom0, VIRQ_MCA);
} else if (++dumpcount >= 10) {